<script>
	import siteInfo from './common/siteinfo';
	import utils from '@/common/utils';
	export default {
		globalData: {
			siteInfo,
			onImgurl: 'https://s.b-ke.cn/static/miniapp/',
			//api: require('./common/config.js'),
		},
		//api: require('./common/config.js'),//这里添加自定义属性无用
		onLaunch: function() {
			// #ifdef H5
			if (!siteInfo.isDev) {
				let params = utils.getUrlParams(location.href); // 地址解析 wq授权调重定向回来带上的应用参数
				this.globalData.siteInfo.uniacid = params.acid;
				this.globalData.siteInfo.eid = params.eid;
				console.log('%c params ', 'color: white; background-color: #f00000', params);
			} else {
				// this.globalData.siteInfo.uniacid = 6
			}
			// #endif
			// console.log('App Launch')
			// this.util.wxAuthorize();
		},
		onShow: async function(data) {
			if (data) {
				if (data.hasOwnProperty('referrerInfo')) {
					if (data.referrerInfo.appId == 'wxeb490c6f9b154ef9') {
						if (data.referrerInfo.extraData) {
							let res = await this.util.request({
								url: this.api.ActivateMembership,
								method: 'POST',
								data: {
									activate_ticket: data.referrerInfo.extraData.activate_ticket,
									card_id: data.referrerInfo.extraData.card_id,
									code: data.referrerInfo.extraData.code,
									userId: this.$store.state.user.userId
								}
							});

							console.log('%c extraData ', 'color: white; background-color: #34aaff', data.referrerInfo, res.data);
						}
					}
				}
			}
		},
		onHide: function() {},

	};
</script>

<style lang="scss">
	@import './common/styles/index.css';

	/*每个页面公共css */

	/* #ifdef H5 */
	uni-page-head {
		display: none;
	}

	/* #endif */
</style>
